/*
package com.gem.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

import javax.sql.DataSource;

*/
/**
 * @author 刘聪
 * Created  on 2020/12/15
 *//*

@Configuration
@EnableWebSecurity
class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    @Autowired
    DataSource dataSource;

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        //允许所有用户访问"/"和"/home"
        http
                .authorizeRequests()
                .antMatchers("/", "/login", "/home", "/register","/product/**").permitAll()
                .anyRequest().authenticated()
                .and()
                .formLogin()
                .loginPage("/login")
                //指定登录页是"/login"
                //.defaultSuccessUrl("/list")
                // 登录成功后默认跳转到"list"

                // 设置登陆成功页
                .defaultSuccessUrl("/home")
                .permitAll()
                .and()
                .logout().permitAll();
                */
/*.and()
                .rememberMe()
                .tokenRepository(per)*//*

    }

    @Override
    public void configure(WebSecurity web) {
        // 设置拦截忽略文件夹，可以对静态资源放行
        web.ignoring().antMatchers("/AmazeUI-2.4/**","/js/**", "/css/**","/Admin/**","/basic/**","images/**");
    }


    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        //inMemoryAuthentication 从内存中获取

        auth
                .inMemoryAuthentication()
                .passwordEncoder(new BCryptPasswordEncoder())
                .withUser("user").password(new BCryptPasswordEncoder().encode("password")).roles("USER");
    }
    //    @Override
//    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
//        this.disableLocalConfigureAuthenticationBldr = true;
//    }
}
*/
